<!--
 * @description  :
 * @descriptionDetail:
 * @copyright    : 重庆烟草
 * @author       : wxy
 * @create       : 2023-09-04 14:30:59
-->

<template>
  <view class="page">
    <!-- #ifdef H5-ONLY -->
    <theme-navbar
      :is-white="false"
      :title="navTitle"
      :custom-back="goBack"
      style="z-index: 99999"
    >
    </theme-navbar>
    <!-- #endif -->
    <view
      class="content content-bg ifn-content"
      style="background-color: white; margin-left='10rpx'"
    >
      <view class="case-tips" v-if="hasCaseUuid()">
        *已录入案件的申报，如遇信息不全不能保存的，请到案件系统中维护相关数据后再进行申请
      </view>
      <u-form
        class="u-form-m"
        :model="baseInfo"
        :error-type="['message', 'border-bottom']"
        label-position="top"
        ref="uForm"
      >
        <u-form-item label="案件名称" prop="caseName" :required="true">
          <u-input
            type="textarea"
            :height="70"
            :needValid="!hasCaseUuid()"
            :disabled="!hasCaseUuid()"
            v-model="baseInfo.caseName"
            placeholder="请输入案件名称"
          >
          </u-input>
          <u-button
            v-if="!hasCaseUuid()"
            slot="right"
            size="mini"
            type="primary"
            @click="(partyName = ''), (partyShow = true)"
          >
            <!-- 为保证数据的格式统一，需要输入当事人以及选择案由来生成案件名称 -->
            编辑
          </u-button>
        </u-form-item>
        <u-form-item :required="true" label="申请单位" prop="orgName">
          <u-input v-model="baseInfo.orgName" :disabled="true"></u-input>
        </u-form-item>
        <u-form-item :required="true" label="案值(万元)" prop="caseTotalVal">
          <u-input
            v-model="baseInfo.caseTotalVal"
            :disabled="hasCaseUuid()"
          ></u-input>
        </u-form-item>
        <u-form-item
          :required="true"
          label="案发时间"
          prop="caseDate"
          rightIcon="calendar"
          :right-icon-style="rightIconStyle"
        >
          <u-input
            :disabled="true"
            v-model="baseInfo.caseDate"
            type="text"
            placeholder="请选择案发时间"
            :needValid="true"
						:custom-style="valueStyle"
            @click="toShowCalendar('caseDate')"
          ></u-input>
        </u-form-item>
        <u-form-item label="案件编号">
          <u-input
            placeholder="关联 案件后自动加载"
            :disabled="true"
            v-model="baseInfo.caseCode"
          ></u-input>
        </u-form-item>
        <u-form-item
          prop="clueSourceName"
          :required="true"
          label="情报来源"
          rightIcon="arrow-right"
          :right-icon-style="rightIconStyle"
        >
          <dic-input
            :keyWord="$u.dic.DIC_KEYS.CLUE_SOURCE"
            :dicCode="baseInfo.clueSource"
            :border="false"
            type="text"
            :select-open="
              dicSelectOpen('clueSource', $u.dic.DIC_KEYS.CLUE_SOURCE)
            "
            placeholder="请选择"
            :disabled="true"
            :needValid="true"
            v-model="baseInfo.clueSourceName"
            @changeInputModelData="
              (name) => {
                $set(baseInfo, 'clueSourceName', name);
              }
            "
            @click="
              showDic(
                $u.dic.DIC_KEYS.CLUE_SOURCE,
                baseInfo.clueSource,
                'clueSource'
              )
            "
          />
        </u-form-item>
        <u-form-item
          prop="cooperateName"
          label="协作单位"
          rightIcon="arrow-right"
          :right-icon-style="rightIconStyle"
        >
          <dic-input
            :keyWord="$u.dic.DIC_KEYS.C_FEEDBACK_ORG_TYPE"
            :dicCode="baseInfo.cooperate"
            :border="false"
            type="text"
            :select-open="
              dicSelectOpen('cooperate', $u.dic.DIC_KEYS.C_FEEDBACK_ORG_TYPE)
            "
            placeholder="请选择"
            :disabled="true"
            :needValid="true"
            v-model="baseInfo.cooperateName"
            @changeInputModelData="
              (name) => {
                $set(baseInfo, 'cooperateName', name);
              }
            "
            @click="
              showDic(
                $u.dic.DIC_KEYS.C_FEEDBACK_ORG_TYPE,
                baseInfo.cooperate,
                'cooperate'
              )
            "
          />
        </u-form-item>
        <u-form-item
          label="案发省市县"
          :right-icon-style="rightIconStyle"
          prop="caseAddr"
          :required="true"
        >
          <u-input
            v-model="baseInfo.caseAddr"
            @click="showAreaClick(4)"
            placeholder="请选择"
            :disabled="true"
            :needValid="true"
						:custom-style="valueStyle"
          >
          </u-input>
          <u-icon
            name="close-circle-fill"
            slot="right"
            color="#c0c4cc"
            size="30"
            v-if="!$u.test.isEmpty(baseInfo.caseAddr)"
            @click="caseCloseBtn"
          ></u-icon>
          <u-icon name="arrow-right" slot="right" size="38"></u-icon>
        </u-form-item>
        <u-form-item prop="casePlace" label="案发地" :required="true">
          <u-input
            placeholder="请输入"
            type="textarea"
            maxlength="1000"
            :disabled="hasCaseUuid() && baseInfo.caseType != '03'"
            v-model="baseInfo.casePlace"
          ></u-input>
        </u-form-item>
        <u-form-item
          prop="getNodeName"
          label="查获环节"
          :required="true"
          rightIcon="arrow-right"
          :right-icon-style="rightIconStyle"
        >
          <!-- v-model="baseInfo.getNodeName" -->
          <dic-input
            :keyWord="$u.dic.DIC_KEYS.GET_NODE"
            :dicCode="baseInfo.getNode"
            :border="false"
            type="text"
            :select-open="
              dicMultiSelectOpen('getNode', $u.dic.DIC_KEYS.GET_NODE)
            "
            placeholder="请选择"
            :disabled="true"
            :needValid="true"
            v-model="baseInfo.getNodeName"
            @changeInputModelData="
              (name) => {
                $set(baseInfo, 'getNodeName', name);
              }
            "
            @click="
              showMultiDic(
                $u.dic.DIC_KEYS.GET_NODE,
                baseInfo.getNode,
                'getNode'
              )
            "
          />
        </u-form-item>
        <u-form-item label="品规个数" prop="goodsCnt" :required="true">
          <u-input
            placeholder="请输入"
            type="text"
            :disabled="hasCaseUuid()"
            v-model="baseInfo.goodsCnt"
          ></u-input>
        </u-form-item>
        <u-form-item label="窝点个数" prop="denCnt" :required="true">
          <u-input
            placeholder="请输入"
            type="number"
            v-model="baseInfo.denCnt"
          ></u-input>
        </u-form-item>
        <u-form-item label="车辆数" prop="carCnt" :required="true">
          <u-input
            placeholder="请输入"
            type="number"
            :disabled="hasCaseUuid()"
            v-model="baseInfo.carCnt"
          ></u-input>
        </u-form-item>
        <u-form-item label="船舶数" prop="shipCnt">
          <u-input
            placeholder="请输入"
            type="number"
            v-model="baseInfo.shipCnt"
          ></u-input>
        </u-form-item>
        <u-form-item label="嫌疑人数" prop="partyCnt" :required="true">
          <u-input
            placeholder="请输入"
            type="number"
            :disabled="hasCaseUuid()"
            v-model="baseInfo.partyCnt"
          ></u-input>
        </u-form-item>
        <u-form-item label="来源省市县" :right-icon-style="rightIconStyle">
          <u-input
            v-model="baseInfo.sourceAddr"
            @click="showAreaClick(1)"
            placeholder="请选择"
            :disabled="true"
						:custom-style="valueStyle"
          >
          </u-input>
          <u-icon
            name="close-circle-fill"
            slot="right"
            color="#c0c4cc"
            size="30"
            v-if="!$u.test.isEmpty(baseInfo.sourceAddr)"
            @click="sourceCloseBtn"
          ></u-icon>
          <u-icon name="arrow-right" slot="right" size="38"></u-icon>
        </u-form-item>
        <u-form-item label="去向省市县" :right-icon-style="rightIconStyle">
          <u-input
            v-model="baseInfo.targetAddr"
            @click="showAreaClick(3)"
            placeholder="请选择"
            :disabled="true"
            :needValid="true"
						:custom-style="valueStyle"
          >
          </u-input>
          <u-icon
            name="close-circle-fill"
            slot="right"
            color="#c0c4cc"
            size="30"
            v-if="!$u.test.isEmpty(baseInfo.targetAddr)"
            @click="targetCloseBtn"
          ></u-icon>
          <u-icon name="arrow-right" slot="right" size="38"></u-icon>
        </u-form-item>
        <fsection
          @rightTap="addChannel"
          title="途径省市"
          rightIcon="plus-circle"
          :rightIconSize="40"
        ></fsection>
        <u-form-item>
          <u-table>
            <u-tr>
              <u-th width="70%"> 途径省市县 </u-th>
              <u-th> 操作 </u-th>
            </u-tr>
            <u-tr v-for="(item, index) in addrList" :key="item.index">
              <u-td width="70%">
                {{ item.channelName || "&nbsp;" }}
              </u-td>
              <u-td style="color: #fa3534">
                <text @click="channelDel(index)"> 删除 </text>
              </u-td>
            </u-tr>
          </u-table>
        </u-form-item>
        <u-gap
          :marginRight="getGapMarginRowNumber()"
          :marginLeft="getGapMarginRowNumber()"
          :height="$theme.cm_section_top_gap_height"
          :bg-color="$theme.cm_form_item_bottom_border_color"
        ></u-gap>
        <fsection
          @rightTap="addGood"
          title="物品信息"
          :rightIcon="hasCaseUuid() ? '' : 'plus-circle'"
          :rightIconSize="40"
        ></fsection>
        <u-form-item>
          <u-table>
            <u-tr>
              <u-th>物品类型</u-th>
              <u-th>物品性质</u-th>
              <u-th>计量单位</u-th>
              <u-th>数量</u-th>
              <u-th v-if="!hasCaseUuid()"> 操作 </u-th>
            </u-tr>
            <u-tr v-for="item in goodsList" :key="item.rdmUuid">
              <u-td>{{ item.goodsTypeName || "&nbsp;" }}</u-td>
              <u-td>{{ item.propTypeName || "&nbsp;" }}</u-td>
              <u-td>{{ item.unit || "&nbsp;" }}</u-td>
              <u-td>{{ item.qty || "&nbsp;" }}</u-td>
              <u-td v-if="!hasCaseUuid()" style="color: #fa3534">
                <text @click="del(item)"> 删除 </text>
              </u-td>
            </u-tr>
          </u-table>
        </u-form-item>
        <u-gap
          :marginRight="getGapMarginRowNumber()"
          :marginLeft="getGapMarginRowNumber()"
          :height="$theme.cm_section_top_gap_height"
          :bg-color="$theme.cm_form_item_bottom_border_color"
        ></u-gap>
        <fsection
          @rightTap="buildReportInfo()"
          title="上报信息"
          rightIcon="shengchengmulu"
          customPrefix="csbi-icon"
          :rightIconSize="40"
        ></fsection>
        <u-form-item label="">
          <u-input
            placeholder="点击按钮生成上报信息"
            type="textarea"
            :disabled="true"
            v-model="baseInfo.reportInfo"
          ></u-input>
        </u-form-item>
      </u-form>
    </view>
    <view class="submit-btns btn-other-cls">
      <u-button plain class="u-btn" type="primary" @click="save">
        保存
      </u-button>
      <u-button class="u-btn" type="primary" @click="submit"> 提交 </u-button>
    </view>
    <u-picker
      mode="time"
      v-model="showCalendar"
      :params="timeParams"
      @confirm="changeDate"
    ></u-picker>
    <u-popup
      :mask-close-able="false"
      v-model="goodPopupShow"
      border-radius="20"
      mode="center"
      width="80%"
      height="630rpx"
    >
      <view class="good-popup-lay">
        <view class="good-popup-lay__title"> 物品信息 </view>
        <view style="margin: 32rpx 0">
          <u-form-item
            label-width="150"
            label="物品类型:"
            label-position="left"
            rightIcon="arrow-right"
          >
            <dic-input
              :keyWord="$u.dic.DIC_KEYS.S_CIG_GOODS_TYPE"
              :dicCode="tmpGood.goodsType"
              :border="false"
              type="text"
              :select-open="
                dicSelectOpen('goodsType', $u.dic.DIC_KEYS.S_CIG_GOODS_TYPE)
              "
              placeholder="请选择"
              :disabled="true"
              v-model="tmpGood.goodsTypeName"
              @changeInputModelData="
                (name) => {
                  $set(tmpGood, 'goodsTypeName', name);
                }
              "
              @click="
                showDic(
                  $u.dic.DIC_KEYS.S_CIG_GOODS_TYPE,
                  tmpGood.goodsType,
                  'goodsType'
                )
              "
            />
          </u-form-item>
          <u-form-item
            label-width="150"
            label="物品性质:"
            label-position="left"
            rightIcon="arrow-right"
          >
            <dic-input
              :keyWord="$u.dic.DIC_KEYS.GOODS_PROP_TYPE"
              :dicCode="tmpGood.propType"
              :border="false"
              type="text"
              :select-open="
                dicSelectOpen('propType', $u.dic.DIC_KEYS.GOODS_PROP_TYPE)
              "
              placeholder="请选择"
              :disabled="true"
              v-model="tmpGood.propTypeName"
              @changeInputModelData="
                (name) => {
                  $set(tmpGood, 'propTypeName', name);
                }
              "
              @click="
                showDic(
                  $u.dic.DIC_KEYS.GOODS_PROP_TYPE,
                  tmpGood.propType,
                  'propType'
                )
              "
            />
          </u-form-item>
          <u-form-item
            label-width="150"
            label="计量单位:"
            label-position="left"
          >
            <u-input
              type="text"
              :disabled="true"
              v-model="tmpGood.unit"
              placeholder=""
              placeholder-style="fontSize:28rpx"
							:custom-style="valueStyle"
            ></u-input>
          </u-form-item>
          <u-form-item label-width="150" label="数量:" label-position="left">
            <u-input
              type="number"
              v-model="tmpGood.qty"
              placeholder="请输入"
              placeholder-style="fontSize:28rpx"
            ></u-input>
          </u-form-item>
        </view>
        <view class="good-popup-lay__btns">
          <u-button
            plain
            type="primary"
            size="medium"
            @click="
              () => {
                goodPopupShow = false;
              }
            "
          >
            取&nbsp;&nbsp;&nbsp;&nbsp;消
          </u-button>
          <u-button type="primary" size="medium" @click="saveGoodPopup">
            保&nbsp;&nbsp;&nbsp;&nbsp;存
          </u-button>
        </view>
      </view>
    </u-popup>
    <u-popup
      :mask-close-able="false"
      v-model="throughProShow"
      border-radius="20"
      mode="center"
      width="85%"
      height="326rpx"
    >
      <view class="good-popup-lay">
        <view style="margin: 32rpx 0">
          <u-form-item
            label-width="160"
            label="途经省市县:"
            label-position="left"
            rightIcon="arrow-right"
          >
            <u-input
              v-model="baseInfo.throughAddr"
              @click="showAreaClick(2)"
              placeholder="请选择"
              :disabled="true"
              :needValid="true"
							:custom-style="valueStyle"
            ></u-input>
            <u-icon
              name="close-circle-fill"
              slot="right"
              color="#c0c4cc"
              v-if="!$u.test.isEmpty(baseInfo.throughAddr)"
              size="30"
              @click="throughCloseBtn"
            ></u-icon>
          </u-form-item>
        </view>
        <view class="good-popup-lay__btns">
          <u-button
            plain
            type="primary"
            size="medium"
            @click="
              () => {
                throughProShow = false;
              }
            "
          >
            取&nbsp;&nbsp;&nbsp;&nbsp;消
          </u-button>
          <u-button type="primary" size="medium" @click="saveThroughPro">
            保&nbsp;&nbsp;&nbsp;&nbsp;存
          </u-button>
        </view>
      </view>
    </u-popup>
    <!-- 下拉选择用 -->
    <dic-choice
      :keyWord="dicKeyWords"
      :currentSelect="dicCurrentSelect"
      v-model="dicShow"
      @confirm="selectDicConfirm"
    ></dic-choice>
    <area-picker
      v-model="areaShow"
      :params="areaParam"
      @confirm="areaConfirm"
    ></area-picker>
    <u-popup v-model="partyShow" mode="center" border-radius="14" width="85%">
      <view class="popup-content">
        <u-form-item label="当事人姓名" label-position="top" label-width="auto">
          <u-input placeholder="多个请用逗号隔开" v-model="partyName"></u-input>
        </u-form-item>
        <view class="popup-submit-btns">
          <u-button plain class="del" type="primary" @click="partyShow = false">
            取消
          </u-button>
          <u-button class="mit" type="primary" @click="saveParty">
            确认
          </u-button>
        </view>
      </view>
    </u-popup>
    <!-- 多选字典组件 -->
    <u-popup mode="bottom" height="50%" v-model="mulitChoiceShow">
      <dic-multi-choice
        :keyWord="dicKeyWords"
        :defaultUids="dicCurrentSelect"
        @select="multiChoiceConfirm"
      ></dic-multi-choice>
    </u-popup>
  </view>
</template>

<script>
import fsection from "@/components/form-section.vue";
import DicChoice from "@/components/dic_choice.vue";
import DicInput from "@/components/dic_input.vue";
import DicMultiChoice from "@/components/dic_multi_choice.vue";
import majorDocMixin from "./majorDocMixin.js";
import bigCaseService from "@/service/case/bigCase.service";
import commonService from "@/service/common/common.service.js";
import areaPicker from "@/components/area-picker.vue";
import { GOODS_TYPE } from "@/service/case/mapping/enum.js";
import { uuid } from "@/common/util.js";
export default {
  components: {
    fsection,
    DicMultiChoice,
    DicInput,
    DicChoice,
    areaPicker,
  },
  mixins: [majorDocMixin],
  onLoad(opt) {
    this.from = opt.from;
    if (this.from == "edit") {
      let parm = this.getRouteParam();
      this.caseParam = {
        id: parm.applyUuid,
        justView: false,
      };
    } else {
      this.caseParam = this.getRouteParam();
      this.caseParam.justView = false;
    }
  },
  data() {
    return {
      mulitChoiceShow: false,
      areaShow: false,
      areaIndex: 0,
      areaParam: {
        province: true,
        city: true,
        area: true,
      },
      timeParams: {
        year: true,
        month: true,
        day: true,
        hour: true,
        minute: true,
        second: false,
        timestamp: true,
      },
      from: "add",
      dicKeyWords: "",
      dicCurrentSelect: "",
      dicShow: false,
      dicType: "",
      user: this.$storage.get(this.$rp.common.USER),
      doc: {},
      tmpGood: {},
      rules: {
        caseName: [
          {
            required: true,
            message: "请输入案件名称",
            // 可以单个或者同时写两个触发验证方式
            trigger: ["change", "blur"],
          },
        ],
        orgName: [
          {
            required: true,
            message: "请输入申报单位",
            // 可以单个或者同时写两个触发验证方式
            trigger: ["change", "blur"],
          },
        ],
        caseTotalVal: [
          {
            required: true,
            message: "请输入案值",
            // 可以单个或者同时写两个触发验证方式
            trigger: ["change", "blur"],
          },
        ],
        caseDate: [
          {
            required: true,
            message: "请选择案发时间",
            // 可以单个或者同时写两个触发验证方式
            trigger: ["change", "blur"],
          },
        ],
        clueSourceName: [
          {
            required: true,
            message: "请输入情报来源",
            // 可以单个或者同时写两个触发验证方式
            trigger: ["change", "blur"],
          },
        ],
        caseAddr: [
          {
            required: true,
            message: "请选择案发省市县",
            // 可以单个或者同时写两个触发验证方式
            trigger: ["change", "blur"],
          },
        ],
        casePlace: [
          {
            required: true,
            message: "请输入案发地点",
            // 可以单个或者同时写两个触发验证方式
            trigger: ["change", "blur"],
          },
        ],
        getNodeName: [
          {
            required: true,
            message: "请输入查货环节",
            // 可以单个或者同时写两个触发验证方式
            trigger: ["change", "blur"],
          },
        ],
        goodsCnt: [
          {
            validator: (rule, value, callback) => {
              console.log(value);
              return !this.$u.test.isEmpty(value);
            },
            message: "请输入品种数",
            // 可以单个或者同时写两个触发验证方式
            trigger: ["change", "blur"],
          },
          {
            validator: (rule, value, callback) => {
              console.log(value);
              return this.$u.test.digits(value);
            },
            message: "请输入整数",
            // 可以单个或者同时写两个触发验证方式
            trigger: ["change", "blur"],
          },
          {
            validator: (rule, value, callback) => {
              console.log(value);
              return this.$u.test.digits(value) && Number(value) >= 1;
            },
            message: "品种数不能小于1",
            // 可以单个或者同时写两个触发验证方式
            trigger: ["change", "blur"],
          },
        ],
        denCnt: [
          {
            // 自定义验证函数，见上说明
            validator: (rule, value, callback) => {
              if (value == 0) {
                return true;
              } else {
                return !this.$u.test.isEmpty(value);
              }
            },
            message: "请输入窝点个数",
            // 触发器可以同时用blur和change
            trigger: ["change", "blur"],
          },
          {
            validator: (rule, value, callback) => {
              console.log(value);
              return this.$u.test.digits(value);
            },
            message: "请输入整数",
            // 可以单个或者同时写两个触发验证方式
            trigger: ["change", "blur"],
          },
        ],
        carCnt: [
          {
            // 自定义验证函数，见上说明
            validator: (rule, value, callback) => {
              if (value == 0) {
                return true;
              } else {
                return !this.$u.test.isEmpty(value);
              }
            },
            message: "请输入车辆数",
            // 触发器可以同时用blur和change
            trigger: ["change", "blur"],
          },
          {
            validator: (rule, value, callback) => {
              console.log(value);
              return this.$u.test.digits(value);
            },
            message: "请输入整数",
            // 可以单个或者同时写两个触发验证方式
            trigger: ["change", "blur"],
          },
        ],
        partyCnt: [
          {
            // 自定义验证函数，见上说明
            validator: (rule, value, callback) => {
              if (value == 0) {
                return true;
              } else {
                return !this.$u.test.isEmpty(value);
              }
            },
            message: "请输入嫌疑人数",
            // 触发器可以同时用blur和change
            trigger: ["change", "blur"],
          },
          {
            validator: (rule, value, callback) => {
              console.log(value);
              return this.$u.test.digits(value);
            },
            message: "请输入整数",
            // 可以单个或者同时写两个触发验证方式
            trigger: ["change", "blur"],
          },
        ],
      },
      baseInfo: {
        isInternetCase: false,
        name: "",
      },
      rightIconStyle: {
        fontSize: "40rpx",
      },
      goodPopupShow: false,
      showCalendar: false,
      changeDataKey: "",
      goodsList: [],
      partyShow: false,
      partyName: "",
      addrList: [],
      throughProShow: false,
			// h5端部分浏览器input设置disabled后点击事件失效 2023-10-25 fsx start
			valueStyle: {
			  marginRight: "5px",
				pointerEvents: "none !important"
			},
			// h5端部分浏览器input设置disabled后点击事件失效 2023-10-25 fsx start
			
    };
  },
  onReady() {
    this.$refs.uForm.setRules(this.rules);
  },
  created() {
    this.init();
  },
  methods: {
    init() {
      // TODO 通过主键ID获取详情信息
      this.$modal.showLoading("加载中...");
      this.docBigCaseStep((docInfo) => {
        if (docInfo == undefined) {
          this.$modal.hideLoading();
          return;
        }
        if (this.from == "edit") {
          this.$set(this.caseParam, "docUuid", docInfo.configIns.docUuid);
          this.$set(this.caseParam, "titemUuid", docInfo.configIns.titemUuid);
        }
        this.doc = docInfo ? docInfo : {};
        this.initDocData();
      });
    },
    changeDate(e) {
      if (this.changeDataKey) {
        this.$set(
          this.baseInfo,
          this.changeDataKey,
          this.$u.timeFormat(e.timestamp, "yyyy年mm月dd日 hh时MM分")
        );
        this.changeDataKey = undefined;
      }
    },
    saveParty() {
      if (this.$u.test.isEmpty(this.partyName)) {
        this.$u.toast("请输入当事人姓名");
        return;
      }
      this.partyShow = false;
      this.$u.route("/pages/case/components/casePropertySelection");
    },
    toShowCalendar(str) {
      if (this.hasCaseUuid()) return;
      this.changeDataKey = str;
      this.showCalendar = true;
    },
    del(itm) {
      let index = -1;
      for (let i = 0; i < this.goodsList.length; i++) {
        if (this.goodsList[i].rdmUuid == itm.rdmUuid) {
          index = i;
          break;
        }
      }
      if (index != -1) {
        this.goodsList.splice(index, 1);
      }
    },
    addGood() {
      if (this.hasCaseUuid()) return;
      this.tmpGood = {};
      if (this.goodsList.length > 0) {
        this.tmpGood.propType =
          this.goodsList[this.goodsList.length - 1].propType;
        this.tmpGood.propTypeName =
          this.goodsList[this.goodsList.length - 1].propTypeName;
        this.tmpGood.goodsType =
          this.goodsList[this.goodsList.length - 1].goodsType;
        this.tmpGood.goodsTypeName =
          this.goodsList[this.goodsList.length - 1].goodsTypeName;
        this.tmpGood.unit = this.goodsList[this.goodsList.length - 1].unit;
        this.tmpGood.qty = this.goodsList[this.goodsList.length - 1].qty;
      }
      this.goodPopupShow = true;
    },
    saveGoodPopup() {
      if (this.$u.test.isEmpty(this.tmpGood.goodsType))
        return this.$u.toast("物品类型不能为空");
      if (
        this.$u.test.isEmpty(this.tmpGood.propType) &&
        this.isCig(this.tmpGood.goodsType)
      )
        return this.$u.toast("物品性质不能为空");
      if (this.$u.test.isEmpty(this.tmpGood.qty))
        return this.$u.toast("数量不能为空");
      this.tmpGood.applyUuid = this.baseInfo.applyUuid || "";
      this.tmpGood.rdmUuid = uuid();
      this.goodsList.push(this.tmpGood);
      this.goodPopupShow = false;
    },
    saveThroughPro() {
      if (this.$u.test.isEmpty(this.baseInfo.throughAddr))
        return this.$u.toast("请选择途经省市");
      let throughName =
        this.baseInfo.throughProvName +
        "/" +
        this.baseInfo.throughCityName +
        "/" +
        this.baseInfo.throughCountryName;
      let throughPro = {
        targetCity: this.baseInfo.throughCity,
        targetProv: this.baseInfo.throughProv,
        targetCountry: this.baseInfo.throughCountry,
        uuid: uuid(),
        channelName: throughName,
      };
      this.addrList.push(throughPro);
      this.throughProShow = false;
    },
    sourceCloseBtn() {
      this.baseInfo.sourceAddr = "";
      this.baseInfo.sourceCity = "";
      this.baseInfo.sourceCityName = "";
      this.baseInfo.sourceProv = "";
      this.baseInfo.sourceProvName = "";
      this.baseInfo.sourceCountry = "";
      this.baseInfo.sourceCountryName = "";
      this.$forceUpdate();
    },
    throughCloseBtn() {
      this.baseInfo.throughAddr = "";
      this.baseInfo.throughCity = "";
      this.baseInfo.throughCityName = "";
      this.baseInfo.throughProv = "";
      this.baseInfo.throughProvName = "";
      this.baseInfo.throughCountry = "";
      this.baseInfo.throughCountryName = "";
      this.$forceUpdate();
    },
    // 案发省市县
    targetCloseBtn() {
      this.baseInfo.targetAddr = "";
      this.baseInfo.targetCity = "";
      this.baseInfo.targetCityName = "";
      this.baseInfo.targetProv = "";
      this.baseInfo.targetProvName = "";
      this.baseInfo.targetCountry = "";
      this.baseInfo.targetCountryName = "";
      this.$forceUpdate();
    },
    caseCloseBtn() {
      this.baseInfo.caseAddr = "";
      this.baseInfo.caseCity = "";
      this.baseInfo.caseCityName = "";
      this.baseInfo.caseProv = "";
      this.baseInfo.caseProvName = "";
      this.baseInfo.caseCountry = "";
      this.baseInfo.caseCountryName = "";
      this.$forceUpdate();
    },
    save() {
      if (this.goodsList.length == 0) {
        this.$u.toast("物品信息不能为空");
        return;
      }
      this.$refs.uForm.validate((valid) => {
        if (valid) {
          this.$modal.showLoading("正在保存...");
          let apParm = this.$u.queryParams({
            docUuid: this.caseParam.docUuid,
            docInsUuid: this.doc.docInsUuid || null,
            titemUuid: this.caseParam.titemUuid,
            gfaCode: "edit",
            belong: "case",
          });
          this.baseInfo.goodsList = this.goodsList;
          this.baseInfo.addrList = this.addrList;
          // this.buildReportInfo();
          bigCaseService
            .saveDoc(this.baseInfo, apParm)
            .then((res) => {
              this.$modal.hideLoading();
              if (res.success) {
                this.$u.toast("保存成功");
                this.baseInfo = res.bean;
                this.baseInfo.sourceAddr = this.getRealAddr(
                  this.baseInfo.sourceProv,
                  this.baseInfo.sourceProvName,
                  this.baseInfo.sourceCityName,
                  this.baseInfo.sourceCountryName
                );
                this.baseInfo.targetAddr = this.getRealAddr(
                  this.baseInfo.targetProv,
                  this.baseInfo.targetProvName,
                  this.baseInfo.targetCityName,
                  this.baseInfo.targetCountryName
                );
                this.baseInfo.throughAddr = this.getRealAddr(
                  this.baseInfo.throughProv,
                  this.baseInfo.throughProvName,
                  this.baseInfo.throughCityName,
                  this.baseInfo.throughCountryName
                );
                this.baseInfo.caseAddr = this.getRealAddr(
                  this.baseInfo.caseProv,
                  this.baseInfo.caseProvName,
                  this.baseInfo.caseCityName,
                  this.baseInfo.caseCountryName
                );
                this.doc = res.data[0];
              } else {
                this.$u.toast(res.msg);
              }
            })
            .catch((e) => {
              this.$modal.hideLoading();
              this.$u.toast("保存失败:" + e);
            });
        }
      });
    },
    submit() {
      if (this.goodsList.length == 0) {
        this.$u.toast("物品信息不能为空");
        return;
      }
      this.$refs.uForm.validate((valid) => {
        if (valid) {
          this.$modal.showLoading("正在保存...");
          let apParm = this.$u.queryParams({
            docUuid: this.caseParam.docUuid,
            docInsUuid: this.doc.docInsUuid || null,
            titemUuid: this.caseParam.titemUuid,
            gfaCode: "edit",
            belong: "case",
          });
          this.baseInfo.goodsList = this.goodsList;
          this.baseInfo.addrList = this.addrList;
          // this.buildReportInfo();
          bigCaseService
            .saveDoc(this.baseInfo, apParm)
            .then((res) => {
              this.$modal.hideLoading();
              if (res.success) {
                this.baseInfo = res.bean;
                this.baseInfo.sourceAddr = this.getRealAddr(
                  this.baseInfo.sourceProv,
                  this.baseInfo.sourceProvName,
                  this.baseInfo.sourceCityName,
                  this.baseInfo.sourceCountryName
                );
                this.baseInfo.targetAddr = this.getRealAddr(
                  this.baseInfo.targetProv,
                  this.baseInfo.targetProvName,
                  this.baseInfo.targetCityName,
                  this.baseInfo.targetCountryName
                );
                this.baseInfo.throughAddr = this.getRealAddr(
                  this.baseInfo.throughProv,
                  this.baseInfo.throughProvName,
                  this.baseInfo.throughCityName,
                  this.baseInfo.throughCountryName
                );
                this.baseInfo.caseAddr = this.getRealAddr(
                  this.baseInfo.caseProv,
                  this.baseInfo.caseProvName,
                  this.baseInfo.caseCityName,
                  this.baseInfo.caseCountryName
                );
                this.doc = res.data[0];
                this.$u.route({
                  url: "/pages/commonPage/flowUserSelectComponent",
                  params: {
                    flowFormCode: this.doc.configIns.flowFormCode,
                    // docInsUuid: this.doc.docInsUuid,
                  },
                });
              } else {
                this.$u.toast(res.msg);
              }
            })
            .catch((e) => {
              this.$modal.hideLoading();
              this.$u.toast("保存失败:" + e);
            });
        }
      });
    },
    updateBackState(param) {
			
      if (param.flowUserSelectBack) {
        // 选择审批人
        let nextPersons = [];
        for (let fu of param.flowUserSelectBack) {
          nextPersons.push(fu.personId);
        }
        console.log(nextPersons.join(","));
        this.doSubmit(nextPersons.join(","));
      } else if (param.caseSelectionData) {
        // 案由选择回调
        let arr = [];
        param.caseSelectionData.map((itm) => {
          arr.push(itm.caseProperty);
        });
				// 修改dom 无法渲染问题 2023-10-25 fsx start
				this.$nextTick(() => {
					// 在 DOM 更新后执行的回调函数
					 this.$set(this.baseInfo, "caseName", this.partyName + arr.join("、"));
				})
       // 修改dom 无法渲染问题 2023-10-25 fsx end
      }
    },
    doSubmit(p) {
      let apParm = this.$u.queryParams({
        docUuid: this.doc.docUuid,
        docInsUuid: this.doc.docInsUuid,
        titemUuid: this.doc.configIns.titemUuid,
        gfaCode: "edit",
        belong: "case",
        nextPersons: p,
      });
      this.$modal.showLoading("正在提交...");
      bigCaseService
        .submitDoc(this.baseInfo, apParm)
        .then((res) => {
          this.$modal.hideLoading();
          if (res.success) {
            this.$u.toast("提交成功");
            this.backPrev({
              paramKey: "refresh",
              param: true,
            });
          } else {
            this.$u.toast(res.msg);
          }
        })
        .catch((e) => {
          this.$modal.hideLoading();
          this.$u.toast("提交失败");
          console.log(e);
        });
    },
    showAreaClick(index) {
      // if(this.hasCaseUuid() && (index == 1 || index == 3)) return;
      this.areaIndex = index;
      this.areaShow = true;
    },
    areaConfirm(e) {
      if (this.areaIndex == 1) {
        this.baseInfo.sourceProv = e.province.areaCode;
        this.baseInfo.sourceProvName = e.province.areaName;
        if (e.area) {
          this.baseInfo.sourceCity = e.city.areaCode;
          this.baseInfo.sourceCityName = e.city.areaName;
          this.baseInfo.sourceCountry = e.area.areaCode;
          this.baseInfo.sourceCountryName = e.area.areaName;
        } else {
          this.baseInfo.sourceCity = e.city.areaCode;
          this.baseInfo.sourceCityName = e.city.areaName;
        }
        this.baseInfo.sourceAddr = this.getRealAddr(
          this.baseInfo.sourceProv,
          this.baseInfo.sourceProvName,
          this.baseInfo.sourceCityName,
          this.baseInfo.sourceCountryName
        );
      } else if (this.areaIndex == 2) {
        this.baseInfo.throughProv = e.province.areaCode;
        this.baseInfo.throughProvName = e.province.areaName;
        if (e.area) {
          this.baseInfo.throughCity = e.city.areaCode;
          this.baseInfo.throughCityName = e.city.areaName;
          this.baseInfo.throughCountry = e.area.areaCode;
          this.baseInfo.throughCountryName = e.area.areaName;
        } else {
          this.baseInfo.throughCity = e.city.areaCode;
          this.baseInfo.throughCityName = e.city.areaName;
        }
        this.baseInfo.throughAddr = this.getRealAddr(
          this.baseInfo.throughProv,
          this.baseInfo.throughProvName,
          this.baseInfo.throughCityName,
          this.baseInfo.throughCountryName
        );
      } else if (this.areaIndex == 3) {
        this.baseInfo.targetProv = e.province.areaCode;
        this.baseInfo.targetProvName = e.province.areaName;
        if (e.area) {
          this.baseInfo.targetCity = e.city.areaCode;
          this.baseInfo.targetCityName = e.city.areaName;
          this.baseInfo.targetCountry = e.area.areaCode;
          this.baseInfo.targetCountryName = e.area.areaName;
        } else {
          this.baseInfo.targetCity = e.city.areaCode;
          this.baseInfo.targetCityName = e.city.areaName;
        }
        this.baseInfo.targetAddr = this.getRealAddr(
          this.baseInfo.targetProv,
          this.baseInfo.targetProvName,
          this.baseInfo.targetCityName,
          this.baseInfo.targetCountryName
        );
      } else if (this.areaIndex == 4) {
        this.baseInfo.caseProv = e.province.areaCode;
        this.baseInfo.caseProvName = e.province.areaName;
        if (e.area) {
          this.baseInfo.caseCity = e.city.areaCode;
          this.baseInfo.caseCityName = e.city.areaName;
          this.baseInfo.caseCountry = e.area.areaCode;
          this.baseInfo.caseCountryName = e.area.areaName;
        } else {
          this.baseInfo.caseCity = e.city.areaCode;
          this.baseInfo.caseCityName = e.city.areaName;
        }
        this.baseInfo.caseAddr = this.getRealAddr(
          this.baseInfo.caseProv,
          this.baseInfo.caseProvName,
          this.baseInfo.caseCityName,
          this.baseInfo.caseCountryName
        );
      }
    },
    // 初始化文书信息
    initDocData() {
      commonService
        .docFields(this.doc.docUuid, true)
        .then((docConfigs) => {
          if (docConfigs.success) {
            this.docFields = [...docConfigs.data];
            // 获取勘验笔录信息参数
            let parms = {
              id: this.caseParam.id || "",
              docUuid: this.doc.docUuid,
              bizUuid: this.doc.bizUuid,
              orgLevel: this.user.orgLevel,
            };
            if (!this.$u.test.isEmpty(this.caseParam.caseUuid)) {
              parms.caseUuid = this.caseParam.caseUuid;
              parms.caseType = this.caseParam.caseType;
            }
            bigCaseService
              .getDoc(parms)
              .then((res) => {
                this.$modal.hideLoading();
                if (!res.success) {
                  this.$u.toast(res.msg);
                  return;
                }
                let [tiInfo, rs] = [{}, {}];
                if (res.data.length === 2) {
                  tiInfo = res.data[0];
                  rs = res.data[1];
                  Object.keys(tiInfo).forEach((key) => {
                    rs[key] = tiInfo[key];
                  });
                } else {
                  rs = res.data[0];
                }
                this.baseInfo = rs;
                if (rs.goodsList) {
                  rs.goodsList.forEach((itm) => {
                    itm.rdmUuid = itm.bigGoodsUuid || uuid();
                  });
                }
                if (
                  this.baseInfo.addrList &&
                  this.baseInfo.addrList.length > 0
                ) {
                  this.addrList = this.baseInfo.addrList;
                  this.addrList.filter((item) => {
                    let obj = item;
                    commonService
                      .findBscAreaStreetByAreaUuid({
                        areaUuid: obj.targetCountry,
                      })
                      .then((res) => {
                        if (res.success) {
                          let text = "";
                          let info = res.bean;
                          if (info.provName) {
                            text += info.provName;
                          }
                          if (info.cityName) {
                            text += "/" + info.cityName;
                          }
                          if (info.countyName) {
                            text += "/" + info.countyName;
                          }
                          this.$set(obj, "channelName", text);
                        }
                      })
                      .catch((err) => {
                        console.log(err);
                      });
                  });
                }
                this.goodsList = rs.goodsList;
                if (this.goodsList == undefined) this.goodsList = [];
                this.goodsList.forEach((itm) => {
                  itm.propTypeName = this.$u.dic.getDicNameByKeyCode(
                    this.$u.dic.DIC_KEYS.GOODS_PROP_TYPE,
                    itm.propType
                  );
                  itm.goodsTypeName = this.$u.dic.getDicNameByKeyCode(
                    this.$u.dic.DIC_KEYS.S_CIG_GOODS_TYPE,
                    itm.goodsType
                  );
                  itm.unit = this.transUnit(itm.goodsType);
                });
                // sourceCity: "130400"
                // sourceProv: "130000"
                // targetCity: "阿坝藏族羌族"
                // targetProv: "510000"
                let sourceAreaProv = commonService.getPersonLocal(
                  rs.sourceProv,
                  true
                );
                this.baseInfo.sourceProvName = sourceAreaProv?.areaName;
                let sourceAreaCity = commonService.getPersonLocal(
                  rs.sourceCity,
                  true
                );
                this.baseInfo.sourceCityName = sourceAreaCity?.areaName;
                this.baseInfo.sourceAddr = this.getRealAddr(
                  rs.sourceProv,
                  rs.sourceProvName,
                  rs.sourceCityName,
                  rs.sourceCountryName
                );
                let throughAreaProv = commonService.getPersonLocal(
                  rs.throughProv,
                  true
                );
                this.baseInfo.throughProvName = throughAreaProv?.areaName;
                let throughAreaCity = commonService.getPersonLocal(
                  rs.throughCity,
                  true
                );
                this.baseInfo.throughCityName = throughAreaCity?.areaName;
                this.baseInfo.throughAddr = this.getRealAddr(
                  rs.throughProv,
                  rs.throughProvName,
                  rs.throughCityName,
                  rs.throughCountryName
                );
                let targetAreaProv = commonService.getPersonLocal(
                  rs.targetProv,
                  true
                );
                this.baseInfo.targetProvName = targetAreaProv?.areaName;
                let targetAreaCity = commonService.getPersonLocal(
                  rs.targetCity,
                  true
                );
                this.baseInfo.targetCityName = targetAreaCity?.areaName;
                this.baseInfo.targetAddr = this.getRealAddr(
                  rs.targetProv,
                  rs.targetProvName,
                  rs.targetCityName,
                  rs.targetCountryName
                );

                let caseAreaProv = commonService.getPersonLocal(
                  rs.caseProv,
                  true
                );
                this.baseInfo.caseProvName = caseAreaProv?.areaName;
                let caseAreaCity = commonService.getPersonLocal(
                  rs.caseCity,
                  true
                );
                this.baseInfo.caseCityName = caseAreaCity?.areaName;
                this.baseInfo.caseAddr = this.getRealAddr(
                  rs.caseProv,
                  rs.caseProvName,
                  rs.caseCityName,
                  rs.caseCountryName
                );

                this.baseInfo.docUuid = this.doc.docUuid;
                if (this.from != "edit") {
                  this.baseInfo.caseUuid = this.caseParam.caseUuid || "";
                  this.baseInfo.caseType = this.caseParam.caseType || "";
                }
                // this.buildReportInfo();
              })
              .catch((e) => {
                this.$modal.hideLoading();
                this.$u.toast("表单请求失败");
              });
          } else {
            this.$modal.hideLoading();
            this.$u.toast(docConfigs.msg);
          }
        })
        .catch((e) => {
          this.$modal.hideLoading();
          this.$u.toast("文书加载失败:" + e);
        });
    },
    channelDel(i) {
      this.addrList.splice(i, 1);
    },
    addChannel() {
      this.throughProShow = true;
      this.baseInfo.throughAddr = "";
    },
    getRealAddr(provCode, provName, cityName, countryName) {
      if (this.$u.test.isEmpty(provName)) return "";
      // if (this.$modal.isMuniCity(provCode)) {
      //   return cityName || '';
      // } else {
      if (provCode == "999999") {
        this.baseInfo.sourceCity = "";
        this.baseInfo.sourceCityName = "";
        return `${provName || ""}`;
      } else {
        return `${provName || ""} ${cityName || ""} ${countryName || ""}`;
      }
      // }
    },
    selectDicConfirm(e) {
      if (this.dicKeyWords == this.$u.dic.DIC_KEYS.CLUE_SOURCE) {
        this.baseInfo.clueSourceName = e[0].label;
        this.baseInfo.clueSource = e[0].extra.bcbCode;
      } else if (this.dicKeyWords == this.$u.dic.DIC_KEYS.GOODS_PROP_TYPE) {
        this.tmpGood.propTypeName = e[0].label;
        this.tmpGood.propType = e[0].extra.bcbCode;
      } else if (this.dicKeyWords == this.$u.dic.DIC_KEYS.S_CIG_GOODS_TYPE) {
        this.tmpGood.goodsTypeName = e[0].label;
        this.tmpGood.goodsType = e[0].extra.bcbCode;
        this.tmpGood.unit = this.transUnit(e[0].extra.bcbCode);
      } else if (this.dicKeyWords == this.$u.dic.DIC_KEYS.C_FEEDBACK_ORG_TYPE) {
        this.baseInfo.cooperateName = e[0].label;
        this.baseInfo.cooperate = e[0].extra.bcbCode;
      }
    },
    dicMultiSelectOpen(type, keyWords) {
      if (type == this.dicType) {
        if (this.dicKeyWords == keyWords && this.mulitChoiceShow) {
          return true;
        }
        return false;
      }
    },
    showMultiDic(key, cur, type) {
      if (this.mulitChoiceShow) return;
      this.dicKeyWords = key;
      this.dicCurrentSelect = cur;
      this.mulitChoiceShow = true;
      this.dicType = type;
    },
    multiChoiceConfirm(e) {
      this.mulitChoiceShow = false;
      let labels = [];
      let codes = [];
      e.forEach((itm) => {
        labels.push(itm.bcbName);
        codes.push(itm.bcbCode);
      });
      if (this.dicKeyWords == this.$u.dic.DIC_KEYS.GET_NODE) {
        this.baseInfo.getNodeName = labels.join(",");
        this.baseInfo.getNode = codes.join(",");
      }
    },
    transUnit(val) {
      let arr = this.$store.state.dicts[this.$u.dic.DIC_KEYS.S_CIG_GOODS_TYPE];
      for (let i = 0; i < arr.length; i++) {
        if (arr[i].bcbCode === val) {
          return arr[i].ext2 ? arr[i].ext2 : arr[i].ext1;
        }
      }
      return "";
    },
    getGapMarginRowNumber() {
      return "-" + this.$theme.cm_content_paddng_row.replace("rpx", "");
    },
    showDic(key, cur, type) {
      if (this.dicShow) return;
      this.dicKeyWords = key;
      this.dicCurrentSelect = cur;
      this.dicShow = true;
      this.dicType = type;
    },
    dicSelectOpen(type, keyWords) {
      if (type == this.dicType) {
        if (this.dicKeyWords == keyWords && this.dicShow) {
          return true;
        }
        return false;
      }
    },
    hasCaseUuid() {
      return !this.$u.test.isEmpty(this.baseInfo.caseUuid);
    },
    hasCasecode() {
      return this.$u.test.isEmpty(this.baseInfo.caseCode);
    },
    buildReportInfo() {
      let data = this.$u.deepClone(this.baseInfo);
      let self = this;
      data.goodsCnt = data.goodsCnt || 0;
      let goodsList = data.goodsList || [];
      goodsList.forEach(function (item) {
        if (!item.propTypeName) {
          item.propTypeName = self.$u.dic.getDicNameByKeyCode(
            self.$u.dic.DIC_KEYS.GOODS_PROP_TYPE,
            item.propType
          );
        }
        if (!item.goodsTypeName) {
          item.goodsTypeName = self.$u.dic.getDicNameByKeyCode(
            self.$u.dic.DIC_KEYS.S_CIG_GOODS_TYPE,
            item.goodsType
          );
        }
      });
      let goodsInfo = {};
      let goodsType = [];
      goodsList.forEach(function (item) {
        let gType = item.goodsType;
        if (gType) {
          let rName = gType;
          // 如果是卷烟 雪茄烟 和新型卷烟则取物品性质.
          if (
            gType === GOODS_TYPE.CIGAR ||
            gType === GOODS_TYPE.CIGARETEE ||
            gType === GOODS_TYPE.NEW_CIGARETEE
          ) {
            rName = item.propTypeName;
            goodsType.push(rName);
          } else {
            rName = item.goodsTypeName;
            goodsType.push(rName);
          }
          let tag = goodsInfo[rName] || {};
          tag.unit = item.unit;
          tag.cnt = (tag.cnt || 0) * 1 + (item.qty || 0) * 1;
          tag.name = rName;
          goodsInfo[rName] = tag;
        }
      });
      let names = [];
      if (goodsType.length === 1) {
        let titem = goodsInfo[goodsType[0]];
        names.push(titem.cnt + "" + (titem.unit || ""));
      } else {
        for (let name in goodsInfo) {
          let tag = goodsInfo[name];
          names.push(tag.name + (tag.cnt + "") + (tag.unit || ""));
        }
      }
      data.goodsType = goodsType.join("、");
      data.goodsInfo =
        names.length > 1 ? "其中" + names.join("、") : names.join("");
      if (data.caseDate && data.caseDate.indexOf("年") === -1) {
        data.caseDate = this.$u.date(
          new Date(data.caseDate.replace(/-/g, "/")).getTime(),
          "yyyy年mm月dd日 hh时MM分"
        );
      }
      let text =
        "【${topArea}${orgName}案件快报】${caseDate}，${topArea}${orgName}根据${clueSourceName}，";
      if (data.cooperateName) {
        text += "会同${cooperateName}，";
      }
      text +=
        "在${getNodeName}环节查获${goodsType}共计${goodsCnt}个品种${goodsInfo}，案值${caseTotalVal}万元。FFFFFFFF";
      if (data.denCnt && data.denCnt > 0) {
        text += "现场捣毁窝点${denCnt}个";
      }
      if (data.carCnt && data.carCnt > 0) {
        text += "，查获车辆${carCnt}辆";
      }
      if (data.shipCnt && data.shipCnt > 0) {
        text += "，船舶${shipCnt}艘";
      }
      if (data.partyCnt && data.partyCnt > 0) {
        text += "，抓获嫌疑人${partyCnt}名";
      }
      if (data.sourceProvName) {
        text += "，货物来源地为${sourceProvName}";
        if (data.sourceCityName) {
          text += "${sourceCityName}";
        }
      }
      if (data.targetProvName) {
        text += "，去向地为${targetProvName}";
        if (data.targetCityName) {
          text += "${targetCityName}";
        }
      }
      if (data.throughProvName) {
        text += "，途经地为${throughProvName}";
        if (data.throughCityName) {
          text += "${throughCityName}";
        }
      }
      let fields = text.match(/\$\{(\S+?)\}/g);
      if (text.indexOf("FFFFFFFF，") > -1) {
        text = text.replace("FFFFFFFF，", "");
      } else {
        text = text.replace("FFFFFFFF", "");
      }
      fields.forEach(function (v, i) {
        let key = v.replace("${", "").replace("}", "");
        let val = data[key] || "/";
        let reg = new RegExp("\\$\\{" + key + "\\}", "g");
        text = text.replaceAll(reg, val);
      });
      this.$set(this.baseInfo, "reportInfo", text);
    },
    isCig(gType) {
      return (
        gType === GOODS_TYPE.CIGAR ||
        gType === GOODS_TYPE.CIGARETEE ||
        gType === GOODS_TYPE.NEW_CIGARETEE
      );
    },
  },
};
</script>

<style scoped lang="scss">
.page {
  padding: 0;
}
.content {
  padding-bottom: 75px;
  padding-top: $cm-conent-padding-column;
  padding-left: $cm-content-paddng-row;
  padding-right: $cm-content-paddng-row;
}
.nav-right-icon {
  margin-right: 30rpx;
  font-size: 0.8rem;
  color: #fff;
}
.popup-content {
  padding: $cm-conent-padding-column $cm-content-paddng-row;
}
.fsection {
  width: 75% !important;
}
.choice {
  position: relative;
  top: 20rpx;
  float: right;
}

.tag {
  display: flex;
  justify-content: flex-start;
  align-items: flex-start;
}

.good-popup-lay {
  padding: $cm-content-paddng-row;
  width: 100%;
  height: 100%;

  &__title {
    font-size: 36rpx;
    font-weight: 600;
    color: $u-main-color;
    margin: 10rpx 0;
    text-align: center;
    width: 100%;
  }

  &__btns {
    width: 100%;
    margin-top: 24rpx;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    uni-button {
      flex: 0.28;
    }
  }
}
.case-tips {
  color: $u-type-error;
  font-size: 24rpx;
  width: 100%;
}
</style>
